<template>
	<view class="home">
		<!-- 自定义导航 -->
		<navbar></navbar>
		<tab :list="tabList" :tabIndex="tabIndex" @tabs="tab"></tab>
		
	<!-- <list-scroll>
			<list-card mode="base"></list-card>
			<list-card mode="image"></list-card>
			<list-card mode="column"></list-card>
		</list-scroll> -->
		<view class="home-list">
			<list @change="change" :activeIndex="activeIndex" :tab="tabList"></list>
		</view>
		
		
		
	</view>
</template>

<script>
	import listItem from '../../../components/list-item/list-item.vue'
	export default {
		data() {
			return {
				tabList:[],
				tabIndex:0,
				activeIndex:0
			}
		},
		onLoad() {
			this.getLabel()
		},
		methods: {
			getLabel() {
				this.$api.get_label().then(res => {
					// console.log(res);
					const {
						data
					} = res
					data.unshift({
						name:'全部'
					})
					this.tabList = data
				})
			},
			tab({data,index}) {
				console.log(data);
				console.log(index);
				this.activeIndex = index
			},
			change(current) {
				// console.log('当前swiper的值',current);
				this.tabIndex = current
				this.activeIndex = current
			}
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
		display: flex;
	}
	.home {
		display: flex;
		flex-direction: column;
		flex:1;
		border: 1px red solid;
		overflow: hidden;
		.home-list {
			flex: 1;
			box-sizing: border-box;
		}
	}
	
	
	
	
</style>
